View Javadoc
1 package net.sf.fastxmldb.impl;
2
3 import org.xmldb.api.base.Collection;
4 import org.xmldb.api.base.Database;
5 import org.xmldb.api.base.ErrorCodes;
6 import org.xmldb.api.base.XMLDBException;
7
8 /***
9 * The Database implementation class
10 * @author jbirchfield
11 */
12 public class DatabaseImpl implements Database {
13
14 /***
15 * The name of our database implementation
16 */
17 public static final String DATABASE_NAME = "fastxmldb";
18
19 private final CollectionBroker collectionBroker =
20 CollectionBroker.getInstance();
21
22 /***
23 * Test if a given URI is handled by this class
24 *
25 *@param uri Description of the Parameter
26 *@return Description of the Return Value
27 *@exception XMLDBException Description of the Exception
28 */
29 public boolean acceptsURI(String uri) throws XMLDBException {
30 return uri.startsWith("xmldb:" + DATABASE_NAME + ":");
31 }
32
33 /***
34 * Retrieve a collection from the database
35 *
36 *@param collection Description of the Parameter
37 *@param user Description of the Parameter
38 *@param password Description of the Parameter
39 *@return The collection value
40 *@exception XMLDBException Description of the Exception
41 */
42 public Collection getCollection(
43 String collection,
44 String user,
45 String password)
46 throws XMLDBException {
47 String col = collection.substring((DATABASE_NAME + ":///db/").length());
48 if (col == null || col.length() == 0) {
49 col = "default";
50 }
51 return collectionBroker.getCollection(col);
52 }
53
54 /***
55 * Gets the conformanceLevel of this XML:DB implementation
56 *
57 *@return The conformanceLevel value
58 *@exception XMLDBException Description of the Exception
59 */
60 public String getConformanceLevel() throws XMLDBException {
61 return "0";
62 }
63
64 /***
65 * not yet implemented
66 * @see org.xmldb.api.base.Configurable#setProperty(String, String)
67 */
68 public void setProperty(String s, String s1) throws XMLDBException {
69 throw new XMLDBException(ErrorCodes.NOT_IMPLEMENTED);
70 }
71
72 /***
73 * not yet implemented
74 * @see org.xmldb.api.base.Configurable#getProperty(String)
75 */
76 public String getProperty(String s) throws XMLDBException {
77 throw new XMLDBException(ErrorCodes.NOT_IMPLEMENTED);
78 }
79
80 /***
81 *
82 * @see org.xmldb.api.base.Database#getName()
83 */
84 public String getName() throws XMLDBException {
85 return DATABASE_NAME;
86 }
87 }
This page was automatically generated by Maven